//
//  AppDelegate+DTCRootController.m
//  BluetoothProject
//
//  Created by JianWei Chen on 16/9/5.
//  Copyright © 2016年 JianWei Chen. All rights reserved.
//

#import "AppDelegate+DTCRootController.h"

@interface AppDelegate ()

@end



@implementation AppDelegate (DTCRootController)

- (void)setRootViewController {

    
    if ([DTCEXRACT_OBJECT(LOGIN) isEqualToString:@"YES"]) {
        TabBarViewController *tabBarVC = [[TabBarViewController alloc] init];
        tabBarVC.selectedIndex = 1;
        self.window.rootViewController = tabBarVC;
        [self.window makeKeyAndVisible];
    } else {
        LoginViewController *loginVC = [[LoginViewController alloc] init];
        UINavigationController *navc = [[UINavigationController alloc]initWithRootViewController:loginVC];
        self.window.rootViewController = navc;

    }
}

- (void)startAPP
{
//    NSDictionary *dic = DTCEXRACT_OBJECT(@"HerconADList");
//    if ([dic[@"data"] count] >= 1) {
//        NSDictionary *imageDic = [dic[@"data"] firstObject];
//        NSString *imageURLString = [NSString stringWithFormat:@"%@%@",dic[@"domain"],imageDic[@"image"]];
//        BOOL downloadSuccess = [DTCEXRACT_OBJECT(imageURLString)boolValue];
//        if (downloadSuccess) {
//            UIStoryboard* mainStoryboard = [UIStoryboard storyboardWithName:@"Login" bundle:nil];
//            AdvertisementViewController *vc = [mainStoryboard instantiateViewControllerWithIdentifier:@"AdvertisementViewController"];
//            [vc setFinishBlock:^{
//                [self setRootViewController];
//            }];
//            self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
//            self.window.rootViewController = vc;
//            [self.window makeKeyAndVisible];
//            return;
//        }
//    }
//    [self setRootViewController];
}
//
- (void)showMainVC
{
    
//    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
//    
//    ShopWebViewController *vc = [[ShopWebViewController alloc]init];
//    NSString *urlString = [NSString stringWithFormat:@"http://admin.weisanyun.cn/weixinpl/common_shop/jiushop/index.php?customer_id=5224"];
//    vc.url = [NSURL URLWithString:urlString];
//    vc.title = @"华尔康商城";
//    UIStoryboard* mainStoryboard = [UIStoryboard storyboardWithName:@"UserMain" bundle:nil];
//    UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
//    self.menuViewController = [[FLSideSlipViewController alloc]initWithRootViewController:nav];
//    self.menuViewController.animationType = AnimationTransition;
//    
//    UserLeftViewController *leftController = [mainStoryboard instantiateViewControllerWithIdentifier:@"UserLeftViewController"];
//    self.menuViewController.leftViewController = leftController;
//    self.menuViewController.canSlideInPush = NO;
    

}

@end
